home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / vcredit / vcredit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  33.5 KB  |  1,237 lines

  1. /*
  2.  * Copyright (c) 1990, 1991 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/collab/vcrEdit/RCS/vcrEdit.c,v 0.36 92/09/29 01:16:39 drapeau Exp $ */
  25. /* $Log:    vcrEdit.c,v $
  26.  * Revision 0.36  92/09/29  01:16:39  drapeau
  27.  * Removed commented, obsolete code that is no longer used or necessary.
  28.  * 
  29.  * Revision 0.35  92/09/08  14:24:55  drapeau
  30.  * Made several changes:
  31.  * * Replaced NTSC-specific references to frame rates with newly-defined
  32.  *   constant "FrameRate", as was done with the VideoObject library.
  33.  *   This variable is defined at compile time from the Makefile.
  34.  * * Modified CheckSelection() and Search() to remove code that was
  35.  *   based on assumptions for the NEC PC-VCR.  In particular, the NEC
  36.  *   does not allow access to the 1st 3 seconds on the tape, so the
  37.  *   vcrEdit application encoded this NEC-specific limitation into the
  38.  *   code.  The limitations are now coded in the NEC driver in the
  39.  *   VideoObject, where they should be.  The vcrEdit application no
  40.  *   longer has arbitrary restrictions on the length of an edit or
  41.  *   the 1st valid frame on the medium.
  42.  * 
  43.  * Revision 0.34  92/09/04  17:06:50  drapeau
  44.  * Modified ForwardStep() and ReverseStep() functions so that they are more
  45.  * robust.  They now check that the deck is either in Pause or Still mode.
  46.  * This is probably a semantic error in the definition of status codes in the
  47.  * VideoObject, but the difference may prove useful at some point, so the
  48.  * correction was made here in vcrEdit instead of in the VideoObject library.
  49.  * 
  50.  * Revision 0.33  92/09/01  16:51:47  drapeau
  51.  * Fixed logic errors in the function "SpeedChange()" so that it does what was
  52.  * intended (the intention was to call "DevPlayAtSpeedDir()" only when the
  53.  * function "DevCalcSpeed()" indicated that the slider had really moved far
  54.  * enough to warrant a change in playback speed).  The error occurred because
  55.  * of two reasons:
  56.  * 1) the static variable "oldSpeed" was reset everytime the function was
  57.  *    entered, instead of being initialized to zero in the function
  58.  *    declaration;
  59.  * 2) the old value for speed was not being updated correctly; it should have
  60.  *    been updated with the "framesPerSecond" variable returned by
  61.  *    DevCalcSpeed().
  62.  * 
  63.  * Revision 0.32  92/05/13  23:58:24  drapeau
  64.  * * Cosmetic changes to the code (formatting, mostly) to
  65.  *   conform with coding standards.
  66.  * * No longer try to identify tapes by the header id at the beginning
  67.  *   of the tape.  This was a feature that turned out to be too
  68.  *   cumbersome, slow, and unreliable.
  69.  * * Changed the name of untitled documents from "untitled" to
  70.  *   "Untitled".
  71.  * 
  72.  * Revision 0.31  92/01/03  17:58:17  drapeau
  73.  * Changed all calls to Browse() to use "0" instead of "NULL", to take
  74.  * into account the ANSI-C definition of NULL as (void*)0.
  75.  * 
  76.  * Revision 0.30  91/09/29  16:09:25  lim
  77.  * Moved DisplayChoice to videoObjects.c
  78.  * Removed mySerialPort.
  79.  * The first item on Player setting list is "None".
  80.  * 
  81.  * Revision 0.29  91/09/26  12:31:05  lim
  82.  * Did casting for xv_get's.
  83.  * bzero'ed "chosenHost"
  84.  * 
  85.  * Revision 0.28  91/09/02  14:29:20  lim
  86.  * Video Mute on options panel reversed.
  87.  * 
  88.  * Revision 0.27  91/08/30  15:14:56  lim
  89.  * Check for sender != NULL in Quit().
  90.  * 
  91.  * Revision 0.26  91/08/28  17:02:11  lim
  92.  * Eject now clears edit list too.
  93.  * 
  94.  * Revision 0.25  91/08/28  15:53:09  lim
  95.  * Forward and reverse step implement still iff the player isn't
  96.  * already in still.
  97.  * 
  98.  * Revision 0.24  91/08/28  14:26:42  lim
  99.  * *** empty log message ***
  100.  * 
  101.  * Revision 0.23  91/08/28  14:06:02  lim
  102.  * Check for error when querying frame.
  103.  * 
  104.  * Revision 0.22  91/08/24  17:59:33  lim
  105.  * Implemented PrintDiagnostics. With command line flag '-d', the 
  106.  * app will launch such that it prints all diag messages.
  107.  * 
  108.  * Revision 0.21  91/08/23  17:22:51  lim
  109.  * 1. Step implements Still as well.
  110.  * 2. Document format has changed.
  111.  * 
  112.  * Revision 0.20  91/08/21  10:43:37  lim
  113.  * Added new variable, mySerialPort, to denote serial port setting on
  114.  * options panel. Initialized to "NOTHING".
  115.  * 
  116.  * Revision 0.19  91/08/20  10:01:18  lim
  117.  * Play() is revised to always set the current audio setting before play.
  118.  * 
  119.  * Revision 0.18  91/08/17  20:49:50  lim
  120.  * OpenPanel now called Browse.
  121.  * 
  122.  * Revision 0.17  91/08/16  13:02:10  lim
  123.  * > Always display 2-digit numbers for hr, sec, min, frame.
  124.  * 
  125.  * Revision 0.16  91/08/16  12:30:22  lim
  126.  * 1. Rename & redo interface. 
  127.  * 2. editFilename textfield has been removed and filename is put on the title bar.
  128.  * 3. Info button and function placed in options panel.
  129.  * 4. Call Browse() with OPENPANEL_CHECK for command line option.
  130.  * 5. If no default player, options panel is set up.
  131.  * 
  132.  * Revision 0.15  91/08/15  12:58:28  lim
  133.  * Changed FileLoad() calls in callback function for Edit button to
  134.  * OpenHandler().
  135.  * 
  136.  * Revision 0.14  91/08/11  18:43:19  lim
  137.  * Replaced XOpenDisplay() call with xv_get(obj, XV_DISPLAY)
  138.  * 
  139.  * Revision 0.13  91/08/09  17:01:23  lim
  140.  * Included OpenPanel.
  141.  * 
  142.  * Revision 0.12  91/08/08  16:23:48  lim
  143.  * 1. Removed speed popup and now uses speedSlider.
  144.  * 2. speedStg is now an array of integers.
  145.  * 3. Removed index table building due to hardware problems.
  146.  * 4. currTape is now an array 'MaxHeaderLength' long. It is passed as a 
  147.  *    second argument to DevQueryMedium().
  148.  * 5. DisplayError() now has 2 arguments. It has been moved to 'videoObjects.c'.
  149.  * 6. DevInit() has been moved to 'videoObjects.c'
  150.  * 7. Added instance pointer to each videoObject call. 'myVideo'
  151.  * 8. Able to choose device to use vcrEdit with.
  152.  * 9. Able to set default device to be installed on startup by setting "vcrEdit.defaultPlayer"
  153.  *    in ~/.Xdefaults.
  154.  * 
  155.  * Revision 0.11  91/07/20  11:42:16  lim
  156.  * Added support for audio and speed settings for each edit.
  157.  * Changed DevPlayFromTo calls to include speed field.
  158.  * 
  159.  * Revision 0.10  91/07/16  16:15:12  lim
  160.  * Initial revision.
  161.  *  */
  162.  
  163. #include "vcrEdit.h"
  164.  
  165. static char rcsid[] = "$Header: /Source/Media/collab/vcrEdit/RCS/vcrEdit.c,v 0.36 92/09/29 01:16:39 drapeau Exp $";
  166.  
  167. /* Variables for command line arguments */
  168. int receiverPort;                            
  169. char* startFilename;                                    
  170. char hostname[MAX_HOSTNAME];                        
  171.  
  172. /* Edit list variables */
  173. int lines;                                /* number of lines in the edit list */
  174. int editnum;                                /* the current selection in the edit list */
  175. int change;                                /* indicates if unsaved changes exist in the edit list */
  176. int clearframe;                                /* determines if the frame/chapter textfield is to be cleared*/
  177. int search;                                /* flag to indicate if a notify procedure is to be executed.
  178.                                        This is necessary because a textfield notify procedure is
  179.                                        executed twice for each key depressed (possibly a XView 
  180.                                        bug */
  181.  
  182. /* Arrays to store edit list info */
  183. char startframe[MAX_LISTSIZE][12]; 
  184. char endframe[MAX_LISTSIZE][12];                    /* arrays to store the start/end frames of
  185.                                        each entry in the edit list */
  186. char label[MAX_LISTSIZE][MAX_LABELSIZE+1];                /* array to store the label of each 
  187.                                        entry in the edit list */
  188. enum AudioType audioStg[MAX_LISTSIZE];                    /* array to store the audio setting for each edit */
  189. int speedStg[MAX_LISTSIZE];                        /* array to store the speed setting for each edit */
  190.  
  191. /* Tape position variables */
  192. int currHr = 0;                                /* current hour */
  193. int currMin = 0;                            /* current minute */
  194. int currSec = 0;                            /* current second */
  195. int currFrame = 0;                            /* current frame */
  196.  
  197. /* Other variables */
  198. Xv_font *font;                                /* Font used in the panel list */
  199. char deviceName[MaxNameLength];                        /* Name of device currently used */
  200. enum Direction dir = Reverse;                        /* flag to indicate which direction to play */
  201. static int input = 0;                            /* which time field has new input */
  202. int plus = 0;                                /* whether TimePlus or TimeMinus is active */
  203. int hitQuit = 0;                            /* Set when Quit button is hit. */
  204. enum Boolean diagMode = No;                        /* Flag : whether diagnostic messages should be printed */
  205.  
  206. /*
  207.  * Instance XV_KEY_DATA key.  An instance is a set of related
  208.  * user interface objects.  A pointer to an object's instance
  209.  * is stored under this key in every object.  This must be a
  210.  * global variable.
  211.  */
  212.  
  213. Attr_attribute    INSTANCE;
  214.  
  215.  
  216. /* GENERAL PROCEDURES USED BY THE FUNCTIONS */
  217.  
  218.   
  219. /* check if a selection is valid */
  220. int
  221.   CheckSelection(int start,
  222.          int end)
  223. {
  224.   char buf[50];
  225.   if (start > end) 
  226.   {
  227.     DisplayError("Invalid current selection:", "Start greater than End.");
  228.     return -1;
  229.   }
  230.   if ((start < 0) || (end < 0))
  231.   {
  232.     DisplayError("Addresses may not be negative numbers.", " ");
  233.     return -1;
  234.   }
  235.   if ((start > MAX_FRAME) || (end > MAX_FRAME)) 
  236.   {
  237.     sprintf (buf, "Maximum frame number allowed is %d.\n", MAX_FRAME);
  238.     DisplayError(buf, " ");
  239.     return -1;
  240.   }
  241.   return 0;
  242. }                                    /* end function CheckSelection */
  243.  
  244. /*
  245.  * This function parses the command line and retrieves all the known options and their arguments.
  246.  * Currently, the two options are hostname and portnumber.
  247.  * After parsing the options, the variable optind will point to the start of those non-option arguments.  
  248.  * In this case, it will be the filename to be loaded.  At present, only one filename will be handled.  
  249.  * So if there are multiple filenames typed, the last one will be loaded.
  250.  */
  251. void CheckOptions(argc, argv)
  252.      int     argc;
  253.      char     **argv;
  254. {
  255.   int optionChar;  
  256.   int option_index = 0;
  257.   static struct option long_options[] =
  258.   {
  259.     {"hostname", 1, 0, 'h'},
  260.     {"portnumber", 1, 0, 'p'},
  261.     {"diagnostics", 0, 0, 'd'},
  262.     {0, 0, 0, 0}
  263.   };
  264.  
  265.   while (1)                                /* Start parsing all known options */
  266.   {
  267.     optionChar = getopt_long_only (argc, argv, "h:p:d:",
  268.                   long_options, &option_index);
  269.     if (optionChar == EOF)                        /* Done with all known options */
  270.     {
  271.       break;
  272.     }
  273.     switch (optionChar)
  274.     {
  275.      case 'h':
  276.       if (optarg) 
  277.       {
  278.     strcpy (hostname, optarg);
  279.       }
  280.       break;
  281.      case 'p':
  282.       if (optarg) 
  283.       {
  284.     receiverPort = atoi(optarg);
  285.       }
  286.       break;
  287.      case 'd':
  288.       diagMode = Yes;
  289.       break;
  290.      default:
  291.       break;
  292.     }
  293.   }
  294.   if (optind < argc)                            /* Check if a filename has been specified */
  295.   {
  296.     startFilename = (char *) malloc (256);
  297.     strcpy (startFilename, argv[optind]);
  298.   }
  299. }
  300.  
  301.  
  302. /* Convert time to address in frames */
  303. int
  304. ConvertToAddress(int hr, int min, int sec, int frame)
  305. {
  306.   int address;
  307.   
  308.   address = FrameRate * (hr * 3600 + min * 60 + sec) + frame;
  309.   return address;
  310. }                                    /* end function ConvertToAddress */
  311.  
  312.  
  313. /* Convert address in frames to time */
  314. void
  315. ConvertToTime(int* hr, int* min, int* sec, int* frame, int  address)
  316. {
  317.   int    framesPerHour;
  318.   int    framesPerMinute;
  319.   int    framesPerSecond;
  320.   
  321.   framesPerHour = 3600 * FrameRate;                    /* 3600 = seconds per hour */
  322.   framesPerMinute = 60 * FrameRate;
  323.   framesPerSecond = FrameRate;
  324.   
  325.   *hr = address / framesPerHour;
  326.   *min = (address % framesPerHour) / framesPerMinute;
  327.   *sec = ((address % framesPerHour) % framesPerMinute) / framesPerSecond;
  328.   *frame = ((address % framesPerHour) % framesPerMinute) % framesPerSecond;
  329. }                                    /* end function ConvertToTime */
  330.  
  331.  
  332.  
  333. /*      REMOTE CONTROLLER FUNCTIONS    */
  334.  
  335. /*
  336.     Button notify proc to open the options popup window (optionsButton)
  337. */
  338. void
  339. Options(item, event)
  340.         Panel_item      item;
  341.         Event           *event;
  342. {
  343.   xv_set(vcrEdit_optionsPopup->optionsPopup, FRAME_CMD_PUSHPIN_IN, TRUE, NULL);
  344.   xv_set(vcrEdit_optionsPopup->optionsPopup, XV_SHOW, TRUE, NULL);
  345. }
  346.  
  347. /*
  348.     Button notify proc to open the edit popup window (editButton)
  349. */
  350. void
  351. Edit(item, event)
  352.         Panel_item      item;
  353.         Event           *event;
  354. {
  355.   xv_set(vcrEdit_editPopup->editPopup, FRAME_CMD_PUSHPIN_IN, TRUE, NULL);
  356.   xv_set(vcrEdit_editPopup->editPopup, XV_SHOW, TRUE, NULL);
  357. }
  358.  
  359.  
  360. /*
  361.  * Notify callback function for `stopButton'.
  362.  * Stop function
  363.  */
  364. void
  365. Stop(item, event)
  366.     Panel_item    item;
  367.     Event        *event;
  368. {
  369.   DevStop(myVideo);
  370. }
  371.  
  372. /*
  373.  * Notify callback function for `ejectButton'.
  374.  * Eject function.
  375.  * Clears edit list, with option to save changed edit lists.
  376.  */
  377. void
  378. Eject(item, event)
  379.      Panel_item         item;
  380.      Event              *event;
  381. {
  382.   int choice;
  383.   
  384.   if (change && lines)
  385.   {
  386.     choice = DisplayChoice("Ejecting tape will erase edit list", "Save edit list first?",
  387.                "Yes", "No");
  388.     if (choice == NOTICE_YES)
  389.     {
  390.       Browse(NULL, BrowseSave, 0, "#VCR Edit Document#", "vcrEdit");
  391.       change = 0;
  392.     }
  393.   }
  394.   DevEject(myVideo);
  395.   EditDeleteAll(NULL, NULL);                        
  396. }
  397.  
  398.  
  399. /*
  400.  * Notify callback function for `searchButton'.
  401.  * Search frame/chapter
  402.  */
  403. void
  404.   Search(Panel_item    item,
  405.      Event*        event)
  406. {
  407.   int address;
  408.   
  409.   address = ConvertToAddress(currHr, currMin, currSec, currFrame);
  410.   
  411.   if (CheckSelection (address, MAX_FRAME) == -1) 
  412.   {
  413.     clearframe = 1;
  414.     return;
  415.   }
  416.   DevPlayFromTo(myVideo, address, address, FrameRate);
  417.   clearframe = 1;
  418. }                                    /* end function Search */
  419.  
  420.  
  421.  
  422. /* Hide Current Slider */
  423. void
  424. HideCurrSlider() 
  425. {
  426.   switch (input) 
  427.   {
  428.    case 0:
  429.     xv_set(vcrEdit_window1->absSlider, XV_SHOW, FALSE, NULL);
  430.     xv_set(vcrEdit_window1->absSlider, PANEL_INACTIVE, TRUE, NULL);
  431.     break;
  432.    case 1:
  433.     xv_set(vcrEdit_window1->hrSlider, XV_SHOW, FALSE, NULL);
  434.     xv_set(vcrEdit_window1->hrSlider, PANEL_INACTIVE, TRUE, NULL);
  435.     break;
  436.    case 2:
  437.     xv_set(vcrEdit_window1->minSlider, XV_SHOW, FALSE, NULL);
  438.     xv_set(vcrEdit_window1->minSlider, PANEL_INACTIVE, TRUE, NULL);
  439.     break;
  440.    case 3:
  441.     xv_set(vcrEdit_window1->secSlider, XV_SHOW, FALSE, NULL);
  442.     xv_set(vcrEdit_window1->secSlider, PANEL_INACTIVE, TRUE, NULL);
  443.     break;
  444.    case 4:
  445.     xv_set(vcrEdit_window1->frameSlider, XV_SHOW, FALSE, NULL);
  446.     xv_set(vcrEdit_window1->frameSlider, PANEL_INACTIVE, TRUE, NULL);
  447.     break;
  448.   }
  449. }
  450.  
  451. /* 
  452.  * Show new slider.
  453.  * Places caret in corresponding text field.
  454.  */
  455. void
  456. ShowSlider(value) 
  457.      int value;
  458. {
  459.   switch (value) 
  460.   {
  461.    case 0:
  462.     xv_set(vcrEdit_window1->absSlider, XV_SHOW, TRUE, NULL);
  463.     xv_set(vcrEdit_window1->absSlider, PANEL_INACTIVE, FALSE, NULL);
  464.     xv_set(vcrEdit_window1->remoteCtrlControls, PANEL_CARET_ITEM, vcrEdit_window1->frameTxt1, NULL);
  465.     break;
  466.    case 1:
  467.     xv_set(vcrEdit_window1->hrSlider, XV_SHOW, TRUE, NULL);
  468.     xv_set(vcrEdit_window1->hrSlider, PANEL_INACTIVE, FALSE, NULL);
  469.     xv_set(vcrEdit_window1->remoteCtrlControls, PANEL_CARET_ITEM, vcrEdit_window1->frameTxt1, NULL);
  470.     break;
  471.    case 2:
  472.     xv_set(vcrEdit_window1->minSlider, XV_SHOW, TRUE, NULL);
  473.     xv_set(vcrEdit_window1->minSlider, PANEL_INACTIVE, FALSE, NULL);
  474.     xv_set(vcrEdit_window1->remoteCtrlControls, PANEL_CARET_ITEM, vcrEdit_window1->frameTxt2, NULL);
  475.     break;
  476.    case 3:
  477.     xv_set(vcrEdit_window1->secSlider, XV_SHOW, TRUE, NULL);
  478.     xv_set(vcrEdit_window1->secSlider, PANEL_INACTIVE, FALSE, NULL);
  479.     xv_set(vcrEdit_window1->remoteCtrlControls, PANEL_CARET_ITEM, vcrEdit_window1->frameTxt3, NULL);
  480.     break;
  481.    case 4:
  482.     xv_set(vcrEdit_window1->frameSlider, XV_SHOW, TRUE, NULL);
  483.     xv_set(vcrEdit_window1->frameSlider, PANEL_INACTIVE, FALSE, NULL);
  484.     xv_set(vcrEdit_window1->remoteCtrlControls, PANEL_CARET_ITEM, vcrEdit_window1->frameTxt4, NULL);
  485.     break;
  486.   }
  487. }
  488.  
  489. /* 
  490.  * Get absolute time. 
  491.  * Show time in textfield.
  492.  * Show time in message. 
  493.  */
  494. void 
  495. ShowAbsTime()
  496. {
  497.   char hr[2];
  498.   char min[2];
  499.   char sec[2];
  500.   char frame[2];
  501.   char time[11];
  502.   
  503.   sprintf(hr, "%.2d", currHr);
  504.   sprintf(min, "%.2d", currMin);
  505.   sprintf(sec, "%.2d", currSec);
  506.   sprintf(frame, "%.2d", currFrame);
  507.   
  508.   xv_set(vcrEdit_window1->frameTxt1, PANEL_VALUE, hr, NULL);
  509.   xv_set(vcrEdit_window1->frameTxt2, PANEL_VALUE, min, NULL);
  510.   xv_set(vcrEdit_window1->frameTxt3, PANEL_VALUE, sec, NULL);
  511.   xv_set(vcrEdit_window1->frameTxt4, PANEL_VALUE, frame, NULL);
  512.  
  513.   sprintf(time, "%.2d:%.2d:%.2d:%.2d", currHr, currMin, currSec, currFrame);
  514.   
  515.   xv_set(vcrEdit_window1->timeMsg, PANEL_LABEL_STRING, time, NULL);
  516.   
  517. }
  518.  
  519. /* 
  520.  * Change absolute time.
  521.  */
  522. void
  523. ChangeAbsTime(field, value)
  524.      int field, value;
  525. {
  526.  
  527.   switch (field) 
  528.   {
  529.    case 1:
  530.     currHr = value;
  531.     break;
  532.    case 2:
  533.     currMin = value;
  534.     break;
  535.    case 3:
  536.     currSec = value;
  537.     break;
  538.    case 4:
  539.     currFrame = value;
  540.     break;
  541.   }
  542.   
  543.   xv_set(vcrEdit_window1->absSlider, PANEL_VALUE, 
  544.      ConvertToAddress(currHr, currMin, currSec, currFrame), NULL);
  545.   
  546. }
  547.  
  548.   
  549.   
  550. /*
  551.  * Notify callback function for `timeStg'.
  552.  * Hides current slider.
  553.  * Shows new slider and places caret in corresponding text field.
  554.  * Shows new time.
  555.  */
  556. void
  557. TimeInput(item, value, event)
  558.     Panel_item    item;
  559.     int        value;
  560.     Event        *event;
  561. {
  562.   if (input != value)                            /* The current slider is not new slider */
  563.   {
  564.     HideCurrSlider();    
  565.     input = value;
  566.     ShowSlider(value);
  567.   }
  568.   
  569.   ShowAbsTime();
  570.     
  571. }
  572.  
  573.  
  574. /*
  575.  * Notify callback function for `minSlider'.
  576.  */
  577. void
  578. MinInput(item, value, event)
  579.     Panel_item    item;
  580.     int        value;
  581.     Event        *event;
  582. {
  583.   ChangeAbsTime(2, value);
  584.   ShowAbsTime();
  585.   
  586. }
  587.  
  588. /*
  589.  * Notify callback function for `secSlider'.
  590.  */
  591. void
  592. SecInput(item, value, event)
  593.     Panel_item    item;
  594.     int        value;
  595.     Event        *event;
  596. {
  597.   ChangeAbsTime(3, value);
  598.   ShowAbsTime();
  599. }
  600.  
  601. /*
  602.  * Notify callback function for `hrSlider'.
  603.  */
  604. void
  605. HrInput(item, value, event)
  606.     Panel_item    item;
  607.     int        value;
  608.     Event        *event;
  609. {
  610.   ChangeAbsTime(1, value);
  611.   ShowAbsTime();
  612. }
  613.  
  614. /*
  615.  * Notify callback function for `frameSlider'.
  616.  */
  617. void
  618. FrameInput(item, value, event)
  619.     Panel_item    item;
  620.     int        value;
  621.     Event        *event;
  622. {
  623.   ChangeAbsTime(4, value);
  624.   ShowAbsTime();
  625. }
  626.  
  627. /*
  628.  * Notify callback function for `absSlider'.
  629.  */
  630. void
  631. AbsInput(item, value, event)
  632.     Panel_item    item;
  633.     int        value;
  634.     Event        *event;
  635. {
  636.   int hr;
  637.   int min;
  638.   int sec;
  639.   int frame;
  640.   
  641.   ConvertToTime(&hr, &min, &sec, &frame, value);
  642.   currHr = hr;
  643.   currMin = min;
  644.   currSec = sec;
  645.   currFrame = frame;
  646.  
  647.   xv_set(vcrEdit_window1->hrSlider, PANEL_VALUE, currHr, NULL);
  648.   xv_set(vcrEdit_window1->minSlider, PANEL_VALUE, currMin, NULL);
  649.   xv_set(vcrEdit_window1->secSlider, PANEL_VALUE, currSec, NULL);
  650.   xv_set(vcrEdit_window1->frameSlider, PANEL_VALUE, currFrame, NULL);
  651.  
  652.   ShowAbsTime();
  653.  
  654. }
  655.  
  656. /*
  657.  * Notify callback function for `timeMinusButton'.
  658.  * Get current text item.
  659.  * Decrement or increment item value.
  660.  * Update corresponding slider value.
  661.  * Display appropriate slider.
  662.  * Display new text item value.
  663.  */
  664. void
  665. TimeMinus(item, event)
  666.     Panel_item    item;
  667.     Event        *event;
  668. {
  669.   Panel_item currItem;
  670.   
  671.   currItem = (Panel_item) xv_get(vcrEdit_window1->remoteCtrlControls, PANEL_CARET_ITEM);
  672.   
  673.   if (currItem == vcrEdit_window1->frameTxt1) {
  674.     if (plus) 
  675.       currHr ++;
  676.     else if (currHr)
  677.       currHr --;
  678.     xv_set(vcrEdit_window1->hrSlider, PANEL_VALUE, currHr, NULL);
  679.     xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 1, NULL);
  680.     TimeInput(item, 1, event);
  681.   }
  682.   else if (currItem == vcrEdit_window1->frameTxt2) {
  683.     if (plus) 
  684.       currMin ++;
  685.     else if (currMin)
  686.       currMin --;
  687.     xv_set(vcrEdit_window1->minSlider, PANEL_VALUE, currMin, NULL);
  688.     xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 2, NULL);
  689.     TimeInput(item, 2, event);
  690.   }
  691.   else if (currItem == vcrEdit_window1->frameTxt3) {
  692.     if (plus) 
  693.       currSec ++;
  694.     else if (currSec)
  695.       currSec --;
  696.     xv_set(vcrEdit_window1->secSlider, PANEL_VALUE,currSec, NULL);
  697.     xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 3, NULL);
  698.     TimeInput(item, 3, event);
  699.   }
  700.   else if (currItem == vcrEdit_window1->frameTxt4) {
  701.     if (plus) 
  702.       currFrame ++;
  703.     else if (currFrame)
  704.       currFrame --;
  705.     xv_set(vcrEdit_window1->frameSlider, PANEL_VALUE, currFrame, NULL);
  706.     xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 4, NULL);
  707.     TimeInput(item, 4, event);
  708.   }
  709.   
  710.   plus = 0;
  711. }
  712.  
  713. /*
  714.  * Notify callback function for `timePlusButton'.
  715.  */
  716. void
  717. TimePlus(item, event)
  718.     Panel_item    item;
  719.     Event        *event;
  720. {
  721.   plus = 1;
  722.   TimeMinus(item, event);
  723. }
  724.  
  725.  
  726.        
  727.  
  728. /*
  729.  * Notify callback function for `frameTxt1'.
  730.  */
  731. Panel_setting
  732. HrTxtInput(item, event)
  733.     Panel_item    item;
  734.     Event        *event;
  735. {
  736.   currHr = atoi((char*) xv_get(vcrEdit_window1->frameTxt1, PANEL_VALUE));
  737.   xv_set(vcrEdit_window1->hrSlider, PANEL_VALUE, currHr, NULL);
  738.   xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 1, NULL);
  739.   TimeInput(item, 1, event);
  740.   return panel_text_notify(item, event);       
  741. }    
  742.  
  743. /*
  744.  * Notify callback function for `frameTxt2'.
  745.  */
  746. Panel_setting
  747. MinTxtInput(item, event)
  748.     Panel_item    item;
  749.     Event        *event;
  750. {
  751.   currMin = atoi((char*) xv_get(vcrEdit_window1->frameTxt2, PANEL_VALUE));
  752.   xv_set(vcrEdit_window1->minSlider, PANEL_VALUE, currMin, NULL);
  753.   xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 2, NULL);
  754.   TimeInput(item, 2, event);
  755.   return panel_text_notify(item, event);
  756. }
  757.  
  758. /*
  759.  * Notify callback function for `frameTxt3'.
  760.  */
  761. Panel_setting
  762. SecTxtInput(item, event)
  763.     Panel_item    item;
  764.     Event        *event;
  765. {
  766.   currSec = atoi((char*) xv_get(vcrEdit_window1->frameTxt3, PANEL_VALUE));
  767.   xv_set(vcrEdit_window1->secSlider, PANEL_VALUE, currSec, NULL);
  768.   xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 3, NULL);
  769.   TimeInput(item, 3, event);
  770.   return panel_text_notify(item, event);
  771. }
  772.  
  773. /*
  774.  * Notify callback function for `frameTxt4'.
  775.  */
  776. Panel_setting
  777. FrameTxtInput(item, event)
  778.     Panel_item    item;
  779.     Event        *event;
  780. {
  781.   currFrame = atoi((char*) xv_get(vcrEdit_window1->frameTxt4, PANEL_VALUE));
  782.   xv_set(vcrEdit_window1->frameSlider, PANEL_VALUE, currFrame, NULL);
  783.   xv_set(vcrEdit_window1->timeStg, PANEL_VALUE, 4, NULL);
  784.   TimeInput(item, 4, event);
  785.   return panel_text_notify(item, event);
  786. }
  787.  
  788. /*
  789.  * Notify callback function for `indexScanFwdButton'.
  790.  */
  791. void
  792. IndexScanFwd(item, event)
  793.     Panel_item    item;
  794.     Event        *event;
  795. {
  796.   DevSetAddMode(myVideo, 1);
  797.   DevFastForward(myVideo);
  798. }
  799.  
  800. /*
  801.  * Notify callback function for `indexScanRevButton'.
  802.  */
  803. void
  804. IndexScanRev(item, event)
  805.     Panel_item    item;
  806.     Event        *event;
  807. {
  808.   DevSetAddMode(myVideo, 1);
  809.   DevReverse(myVideo);
  810. }
  811.  
  812.     
  813.  
  814. /* Displays current time address in text fields
  815.  * Sets the sliders to the appropriate values
  816.  * Displays time message above slider
  817.  */
  818. void 
  819. DisplayCurrentFrame(address)
  820.      int address;
  821. {
  822.   int hr;
  823.   int min;
  824.   int sec;
  825.   int fr;
  826.   char hour[2];
  827.   char minute[2];
  828.   char second[2];
  829.   char frame[2];
  830.   char time[11];
  831.   
  832.   ConvertToTime(&hr, &min, &sec, &fr, address);
  833.   
  834.   currHr = hr;
  835.   currMin = min;
  836.   currSec = sec;
  837.   currFrame = fr;
  838.   
  839.   sprintf(hour, "%.2d", hr);
  840.   sprintf(minute, "%.2d", min);
  841.   sprintf(second, "%.2d", sec);
  842.   sprintf(frame, "%.2d", fr);
  843.   sprintf(time, "%.2d:%.2d:%.2d:%.2d", hr, min, sec, fr);
  844.   
  845.   xv_set(vcrEdit_window1->frameTxt1, PANEL_VALUE, hour, NULL);
  846.   xv_set(vcrEdit_window1->frameTxt2, PANEL_VALUE, minute, NULL);
  847.   xv_set(vcrEdit_window1->frameTxt3, PANEL_VALUE, second, NULL);
  848.   xv_set(vcrEdit_window1->frameTxt4, PANEL_VALUE, frame, NULL);
  849.   
  850.   xv_set(vcrEdit_window1->timeMsg, PANEL_LABEL_STRING, time, NULL);
  851.   
  852.   xv_set(vcrEdit_window1->absSlider, PANEL_VALUE, address, NULL);
  853.   xv_set(vcrEdit_window1->hrSlider, PANEL_VALUE, hr, NULL);
  854.   xv_set(vcrEdit_window1->minSlider, PANEL_VALUE, min, NULL);
  855.   xv_set(vcrEdit_window1->secSlider, PANEL_VALUE, sec, NULL);
  856.   xv_set(vcrEdit_window1->frameSlider, PANEL_VALUE, fr, NULL);
  857. }
  858.  
  859. /*
  860.  * Notify callback function for `currFrameButton'.
  861.  * Gives the current frame/chapter number.
  862.  */
  863. void
  864. CurrentFrame(item, event)
  865.     Panel_item    item;
  866.     Event        *event;
  867. {
  868.   int address;
  869.   address = DevQueryFrame(myVideo);
  870.   if (address != PlayerReturnError)
  871.     DisplayCurrentFrame(address);
  872.   clearframe = 1;
  873. }
  874.  
  875.  
  876. /*
  877.  * Notify callback function for `scanRevButton'.
  878.  */
  879. void
  880. ScanReverse(item, event)
  881.     Panel_item      item;
  882.     Event           *event;
  883. {
  884.   DevReverse(myVideo);
  885. }
  886.  
  887. /*
  888.  * Notify callback function for `scanFwdButton'.
  889.  */
  890. void
  891. ScanForward(item, event)
  892.     Panel_item      item;
  893.     Event           *event;
  894. {
  895.   DevFastForward(myVideo);
  896. }
  897.  
  898.  
  899. /*
  900.  * Notify callback function for `playButton'.
  901.  * Play
  902.  */
  903. void
  904. Play(item, event)
  905.     Panel_item    item;
  906.     Event        *event;
  907. {
  908.   int audioSetting;
  909.   audioSetting = xv_get(vcrEdit_optionsPopup->optionsAudioStg, PANEL_VALUE);
  910.   DevSetAudio(myVideo, audioSetting);
  911.   DevPlay(myVideo);
  912. }
  913.  
  914. /*
  915.  * Notify callback function for `indexNextButton'.
  916.  */
  917. void
  918. NextIndexSearch(item, event)
  919.     Panel_item    item;
  920.     Event        *event;
  921. {
  922.     DevSetAddMode(myVideo, 1);
  923.     DevPlayFromTo(myVideo, 1, 0, FrameRate);                /* Special semantics : toAdd is direction */
  924.                                     /* 0 = Forward */
  925. }
  926.  
  927.  
  928. /*
  929.  * Notify callback function for `indexPrevButton'.
  930.  */
  931. void
  932. PrevIndexSearch(item, event)
  933.     Panel_item    item;
  934.     Event        *event;
  935. {
  936.     DevSetAddMode(myVideo, 1);                        /* Set to index */
  937.     DevPlayFromTo(myVideo, 1, 1, FrameRate);                /* Special semantics : toAdd is direction */
  938.                                     /* 1 = Reverse */
  939. }
  940.  
  941.  
  942. /*
  943.  * Notify callback function for `pauseButton'.
  944.  * Pause mode (video does not appear on screen)
  945.  */
  946. void
  947. Pause(item, event)
  948.      Panel_item    item;
  949.      Event        *event;
  950. {  
  951.   DevStill(myVideo);
  952. }
  953.  
  954.  
  955.  
  956. /*
  957.  * Notify callback function for `fwdStepButton'.
  958.  */
  959. void
  960. ForwardStep(item, event)
  961.      Panel_item    item;
  962.      Event        *event;
  963. {
  964.   int status;
  965.   
  966.   status = DevQueryStatus(myVideo);
  967.   if ((status != PlayerPause) && (status != PlayerStill))
  968.     DevStill(myVideo);
  969.   DevStep(myVideo, Forward);
  970. }
  971.  
  972.  
  973. /*
  974.  * Notify callback function for `revStepButton'.
  975.  */
  976. void
  977. ReverseStep(item, event)
  978.     Panel_item    item;
  979.     Event        *event;
  980. {
  981.   int status;
  982.   
  983.   status = DevQueryStatus(myVideo);
  984.   if ((status != PlayerPause) && (status != PlayerStill))
  985.     DevStill(myVideo);
  986.   DevStep(myVideo, Reverse);
  987. }
  988.  
  989.  
  990.  
  991. /*
  992.  * Notify callback function for `speedSlider'.
  993.  */
  994. void
  995.   SpeedChange(item, value, event)
  996. Panel_item    item;
  997. int        value;
  998. Event        *event;
  999. {
  1000.   char            s[5];
  1001.   static int        oldspeed = 0;
  1002.   enum Direction    direction;
  1003.   int            framesPerSecond;
  1004.   
  1005.   direction = Forward;
  1006.   if (event_is_up(event))                        /* Put in still mode if mouse button is up */
  1007.   {
  1008.     oldspeed = 0;
  1009.     xv_set(item, PANEL_VALUE, 0, NULL);
  1010.     xv_set(vcrEdit_window1->speedTxt, PANEL_VALUE, " ", NULL);
  1011.     DevStill(myVideo);
  1012.     return;
  1013.   }
  1014.   if (value < 0)                            /* Check if forward or reverse play */
  1015.   {
  1016.     s[0] = '-';
  1017.     value = -value;
  1018.     direction = Reverse;
  1019.   }
  1020.   else 
  1021.     s[0] = ' ';
  1022.   
  1023.   framesPerSecond = DevCalcSpeed(myVideo, value, 0);            /* Calculate the speed to that requested */
  1024.   sprintf (&s[1], "%d", framesPerSecond);
  1025.   
  1026.   if ((framesPerSecond != oldspeed) && (framesPerSecond != 0))        /* Was a speed change really requested? */
  1027.   {
  1028.     oldspeed = framesPerSecond;
  1029.     xv_set(vcrEdit_window1->speedTxt, 
  1030.        PANEL_VALUE, s, 
  1031.        NULL);
  1032.     DevPlayAtSpeedDir(myVideo, framesPerSecond, direction);
  1033.   }
  1034. }                                    /* end function SpeedChange */
  1035.  
  1036. /*
  1037.  * Notify callback function for `powerButton'.
  1038.  */
  1039. void
  1040. Power(item, event)
  1041.      Panel_item    item;
  1042.      Event        *event;
  1043. {
  1044.   DevPower(myVideo, -1);
  1045. }
  1046.  
  1047.  
  1048. /*
  1049.  * Notify callback function for `quitButton'.
  1050.  * Quit from the whole program
  1051.  */
  1052. void
  1053. Quit(item, event)
  1054.      Panel_item    item;
  1055.      Event        *event;
  1056. {
  1057.   int result;
  1058.   
  1059.   hitQuit = 1;
  1060.   
  1061.                                     /* check if unsaved changes exist in edit list */
  1062.   if ((change) && (lines > 0)) {
  1063.     result = DisplayChoice("Unsaved changes exist in the edit list.",
  1064.                "Go ahead and quit? ",
  1065.                "No", "Yes");                /* Labels are inverted so that defaults to "No" */
  1066.     if (result == NOTICE_YES)
  1067.     {
  1068.       hitQuit = 0;
  1069.       return;
  1070.     }
  1071.     
  1072.   }
  1073.   indexing = 0;
  1074.   
  1075.   if (sender)
  1076.     SenderDisconnectFromPortMgr(sender,&(receiver->receivePort));
  1077.   xv_destroy_safe(vcrEdit_window1->window1);
  1078. }
  1079.  
  1080.  
  1081. /* FUNCTIONS FOR INFO POPUP WINDOW */
  1082. /*
  1083.  * Notify callback function for `infoOKButton'.
  1084.  * Close the info popup window
  1085.  */
  1086. void
  1087. InfoDone(item, event)
  1088.         Panel_item      item;
  1089.         Event           *event;
  1090. {
  1091.   xv_set(vcrEdit_infoPopup->infoPopup, FRAME_CMD_PUSHPIN_IN, FALSE, NULL);
  1092.   xv_set(vcrEdit_infoPopup->infoPopup, XV_SHOW, FALSE, NULL);
  1093. }
  1094.  
  1095.  
  1096.  
  1097. #ifdef MAIN
  1098.  
  1099. void
  1100.   main(argc, argv)
  1101. int    argc;
  1102. char    **argv;
  1103. {
  1104.   int i; 
  1105.   int value;
  1106.   Display* display;
  1107.   char* defaultPlayer;  
  1108.   Rect  tempRect;
  1109.   
  1110.   xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);            /* Initialize XView. */
  1111.   INSTANCE = xv_unique_key();
  1112.   strcpy(hostname, "localhost");                    /* Check parameters passed in */
  1113.   startFilename = NULL;
  1114.   sprintf(currentFilename, "Untitled");
  1115.   receiverPort = AnyPort;
  1116.   CheckOptions(argc, argv);
  1117.   
  1118.   vcrEdit_window1 =                            /* Initialize user interface components. */
  1119.     vcrEdit_window1_objects_initialize(NULL, NULL);
  1120.   vcrEdit_optionsPopup =
  1121.     vcrEdit_optionsPopup_objects_initialize(NULL,vcrEdit_window1->window1);
  1122.   vcrEdit_editPopup =
  1123.     vcrEdit_editPopup_objects_initialize(NULL,vcrEdit_window1->window1);
  1124.   vcrEdit_previewPopup =
  1125.     vcrEdit_previewPopup_objects_initialize(NULL,vcrEdit_window1->window1);
  1126.   vcrEdit_infoPopup =
  1127.     vcrEdit_infoPopup_objects_initialize(NULL,vcrEdit_window1->window1);
  1128.   
  1129.   frame_get_rect(vcrEdit_window1->window1,&tempRect);            /* Get the size of the top-level window */
  1130.   tempRect.r_top = 250;
  1131.   tempRect.r_left = 200;
  1132.   frame_set_rect(vcrEdit_window1->window1,&tempRect);            /* Set the position of the top-level window */
  1133.   
  1134.   font = (Xv_font *) xv_find(vcrEdit_editPopup->editPopup, FONT,    /* Set fonts */
  1135.                  FONT_FAMILY, FONT_FAMILY_LUCIDA_FIXEDWIDTH,
  1136.                  FONT_STYLE,  FONT_STYLE_NORMAL,
  1137.                  FONT_SIZE, 12,
  1138.                  NULL);
  1139.   xv_set(vcrEdit_window1->window1,                    /* Initialize some window attributes */
  1140.      FRAME_LEFT_FOOTER, "Display : Off",
  1141.      FRAME_RIGHT_FOOTER, "Audio : Stereo",
  1142.      NULL);
  1143.   xv_set(vcrEdit_optionsPopup->optionsPopup, 
  1144.      XV_X, 200,
  1145.      XV_Y, 0,
  1146.      NULL);
  1147.   xv_set(vcrEdit_editPopup->editPopup, 
  1148.      XV_X, 450,
  1149.      XV_Y, 250,
  1150.      FRAME_DONE_PROC, EditDone,
  1151.      NULL);
  1152.   xv_set(vcrEdit_previewPopup->previewPopup, 
  1153.      XV_X, 910,
  1154.      XV_Y, 560,
  1155.      NULL);
  1156.   xv_set(vcrEdit_infoPopup->infoPopup, 
  1157.      XV_X, 200,
  1158.      XV_Y, 250,
  1159.      NULL);
  1160.   
  1161.   xv_set(vcrEdit_optionsPopup->optionsAudioStg, PANEL_VALUE, 3, NULL);
  1162.   xv_set(vcrEdit_optionsPopup->optionsVideoStg, PANEL_VALUE, 1, NULL);
  1163.   xv_set(vcrEdit_optionsPopup->optionsMutedScreen, PANEL_VALUE, 2, NULL);
  1164.   xv_set(vcrEdit_optionsPopup->optionsBrightStg, PANEL_VALUE, 0, NULL);
  1165.   xv_set(vcrEdit_previewPopup->previewPlayFirstTxt, PANEL_VALUE, 4, NULL);
  1166.   xv_set(vcrEdit_previewPopup->previewPlayLastTxt, PANEL_VALUE, 4, NULL);
  1167.   xv_set(vcrEdit_window1->frameTxt1, PANEL_VALUE, "00", NULL);
  1168.   xv_set(vcrEdit_window1->frameTxt2, PANEL_VALUE, "00", NULL);
  1169.   xv_set(vcrEdit_window1->frameTxt3, PANEL_VALUE, "00", NULL);
  1170.   xv_set(vcrEdit_window1->frameTxt4, PANEL_VALUE, "00", NULL);
  1171.   xv_set(vcrEdit_window1->frameTxt1, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1172.   xv_set(vcrEdit_window1->frameTxt2, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1173.   xv_set(vcrEdit_window1->frameTxt3, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1174.   xv_set(vcrEdit_window1->frameTxt4, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1175.   xv_set(vcrEdit_window1->hrSlider, XV_SHOW, FALSE, NULL);
  1176.   xv_set(vcrEdit_window1->minSlider, XV_SHOW, FALSE, NULL);
  1177.   xv_set(vcrEdit_window1->secSlider, XV_SHOW, FALSE, NULL);
  1178.   xv_set(vcrEdit_window1->frameSlider, XV_SHOW, FALSE, NULL);
  1179.   xv_set(vcrEdit_window1->hrSlider, PANEL_INACTIVE, TRUE, NULL);
  1180.   xv_set(vcrEdit_window1->minSlider, PANEL_INACTIVE, TRUE, NULL);
  1181.   xv_set(vcrEdit_window1->secSlider, PANEL_INACTIVE, TRUE, NULL);
  1182.   xv_set(vcrEdit_window1->frameSlider, PANEL_INACTIVE, TRUE, NULL);
  1183.   xv_set(vcrEdit_window1->absSlider, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1184.   xv_set(vcrEdit_window1->hrSlider, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1185.   xv_set(vcrEdit_window1->minSlider, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1186.   xv_set(vcrEdit_window1->secSlider, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1187.   xv_set(vcrEdit_window1->frameSlider, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1188.   xv_set(vcrEdit_window1->speedSlider, PANEL_NOTIFY_LEVEL, PANEL_ALL, NULL);
  1189.   xv_set(vcrEdit_editPopup->editSpeedTxt, PANEL_VALUE, FrameRate, NULL);
  1190.   if (startFilename)
  1191.     Browse(startFilename, BrowseCheckOpen, 0,            
  1192.        "#VCR Edit Document#", "vcrEdit");                
  1193.   xv_set(vcrEdit_editPopup->editModButton,                /* Set modify, delete buttons to inactive */
  1194.      PANEL_INACTIVE, TRUE, NULL);
  1195.   xv_set(vcrEdit_editPopup->editDelButton,
  1196.      PANEL_INACTIVE, TRUE, NULL);
  1197.   InitNetwork(hostname);                        /* Initialize network stuff */
  1198.   bzero(chosenHost, MAX_HOSTNAME);                    /* Initialize chosen hostname array */
  1199.   
  1200.   display =  (Display*) xv_get(vcrEdit_window1->window1, XV_DISPLAY);
  1201.   defaultPlayer = XGetDefault(display, "vcrEdit", "defaultPlayer");
  1202.   value = 0;
  1203.   
  1204.   xv_set(vcrEdit_optionsPopup->optionsPlayerStg, 
  1205.      PANEL_NCHOICES, numDevices, NULL);
  1206.   for (i=1; i < numDevices+1; i++)
  1207.   {
  1208.     xv_set(vcrEdit_optionsPopup->optionsPlayerStg,
  1209.        PANEL_CHOICE_STRING, i, allDevices[i-1], 
  1210.        NULL);
  1211.     if (defaultPlayer)
  1212.       if (strcmp(defaultPlayer, allDevices[i-1]) == 0)
  1213.     value = i+1;
  1214.   }
  1215.   
  1216.   if (value)
  1217.     xv_set(vcrEdit_optionsPopup->optionsPlayerStg,            /* Set player setting to default player */
  1218.        PANEL_VALUE, value-1,
  1219.        NULL);
  1220.   
  1221.   if (defaultPlayer)
  1222.     SetPlayer(NULL, value-1, NULL);                    /* Set up default player */
  1223.   else
  1224.     Options(NULL, NULL);
  1225.   
  1226.   CreateBrowse(OpenHandler, SaveHandler, vcrEdit_window1->window1);
  1227.   
  1228.   xv_main_loop(vcrEdit_window1->window1);
  1229.   
  1230.   if (!hitQuit)
  1231.     Quit(NULL, NULL);
  1232.   
  1233.   exit(0);
  1234. }                                    /* end function main */
  1235.  
  1236. #endif
  1237.